﻿using System;
using Mvvm;
using Microsoft.Win32;
using RelayCommand = LayoutPlanning.Helpers.RelayCommand;

namespace LayoutPlanning.Model
{
    [Serializable]
    public class Product : BindableBase
    {
        private string _graficFile;
        private string _name;
        private double _weight;

        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                RaisePropertyChanged();
            }
        }


        public double Weight
        {
            get { return _weight; }
            set
            {
                _weight = value;
                RaisePropertyChanged();
            }
        }

        public String GraficFile
        {
            get { return _graficFile; }
            set
            {
                _graficFile = value;
                RaisePropertyChanged();
            }
        }

        public RelayCommand ChooseFiles
        {
            get
            {
                return new RelayCommand(() =>
                {
                    var dialog = new OpenFileDialog();
                    dialog.AddExtension = true;
                    dialog.Filter = "All (*.*)|*.*";


                    if (dialog.ShowDialog() ?? false)
                    {
                        GraficFile = dialog.FileName;
                    }
                });
            }
        }
    }
}